package com.zhida.common.Enum;

import lombok.Data;

/**
 * Create by zhh 2024/7/18 23:47
 */

public enum CourseType {
    NORMAL(1, "普通课程"),
    PAID(2,"收费课程"),
    VIP(3,"VIP课程");

    private final int code;
    private final String description;

    CourseType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static CourseType fromCode(int code){
        for (CourseType type : CourseType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Unknown course type code: " + code);
    }
}
